import { WidgetType, WidgetOption } from '@/types'
import input from '../input'
import WidgetNumber from './WidgetNumber.vue'
import NumberSetting from './NumberSetting.vue'
import NumberFill from './NumberFill.vue'

/** 数字 */
export default {
  ...input,
  key: 'number',
  name: '数字',
  type: WidgetType.NUMBER,
  icon: 'fa-icon-widget-number',

  componentExtend: WidgetNumber,
  settingComponent: NumberSetting,
  fillingComponent: NumberFill,

  labelTips(widget) {
    const { numberFixed: fixed, numberFixedLimit: limit } = widget
    return limit ? (fixed ? `保留${fixed}位小数` : '整数') : ''
  },

  text: {
    maxLength: 26
  }
} as WidgetOption
